#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: day3.py 
@version:
@time: 2023/12/20 
"""


class Node:
    def __init__(self, val=None, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right


node1 = Node(1)
node2 = Node(2)
node3 = Node(3)

node1.right = node2
node2.left = node3

"""
    1
     \
      2
    /
   3
"""


class Solution:
    def pre_order(self, List, root):
        if root is None:
            return
        List.append(root.val)
        self.pre_order(List, root.left)
        self.pre_order(List, root.right)

    def pre_order_traversal(self, root):
        List = []
        self.pre_order(List, root)
        return List


res = Solution().pre_order_traversal(node1)
print(res)
